//
//  LineTwoTypesStyle.cpp
//  fingeradvanture
//
//  Created by shuaibincheng on 16/5/18.
//  只适用于线性结构的队伍，这种风格的队伍包含两种类型: 奇数位跟偶数位分别使用不同的类型
//

#include "LineTwoTypesStyle.hpp"
#include "Utils.hpp"

MonsterType LineTwoTypesStyle::next()
{
    auto current = numOfMonsters - remaining + 1;
    if(even == MONSTER_UNKNOWN || odd == MONSTER_UNKNOWN)
    {
        auto oddTypes = oddAllowedMonsterType();
        auto index = Utils::random_int(oddTypes.size());
        odd = oddTypes[index];
        
        auto evenTypes = evenAllowedMonsterType();
        index = Utils::random_int(evenTypes.size());
        even = evenTypes[index];
    }
    if(current % 2)
        return odd;
    else
        return even;
}

std::vector<MonsterType> LineTwoTypesStyle::oddAllowedMonsterType()
{
    std::vector<MonsterType> types;
    
    types.push_back(MONSTER_1);
    types.push_back(MONSTER_2);
    types.push_back(MONSTER_3);
    types.push_back(MONSTER_6);
    
    return types;
}

std::vector<MonsterType> LineTwoTypesStyle::evenAllowedMonsterType()
{
    std::vector<MonsterType> types;
    
    types.push_back(MONSTER_4);
    types.push_back(MONSTER_5);
    
    return types;
}